package com.health.remote;

import com.health.fallback.ProductRemoteFallBack;
import com.health.pojo.Product;
import com.health.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 使用feign发送远程请求的接口
 * 搭桥-服务消费者和服务提供者,单参数需要注解@RequestParam
 */
@FeignClient(name = "client-product",fallback = ProductRemoteFallBack.class)
public interface ProductRemote {

    @RequestMapping("product/getProductById/{productId}")
     String getProductById( @PathVariable(value = "productId") Integer id);

    //普通参数必须注解@RequestParam
    @RequestMapping("product/getProductById2")
    Product getProductById2(@RequestParam Integer id, @RequestBody User user);
}
